package com.study.singleton.pojo;

/**
 * @ClassName: SafeUnLazySingleton
 * @Description: 饿汉式，线程安全
 * @Details: 基于classloader机制避免了多线程的同步问题
 * @Author: 郑港旭
 * @Create: 2021-11-09 17:29
 **/
public class SafeUnLazySingleton {
    private static SafeUnLazySingleton instance = new SafeUnLazySingleton();

    private SafeUnLazySingleton(){

    }

    public static SafeUnLazySingleton getInstance(){
        return instance;
    }

    public void showMessage(){
        System.out.println("Hello world");
    }
}
